package ctn.hibernate.po;

// Generated 2011-12-8 2:29:36 by Hibernate Tools 3.2.4.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * CtnCpaSpec generated by hbm2java
 */
@Entity
@Table(name = "ctn_cpa_spec", catalog = "cpa")
public class CtnCpaSpec implements java.io.Serializable,Comparable{

	private int id;
	private CpaFun cpaFun;
	private CtnUser ctnUser;
	private CtnCpaVer ctnCpaVer;
	private String specTyp;
	private String fileName;
	private Date createDate;

	public CtnCpaSpec() {
	}

	public CtnCpaSpec(int id) {
		this.id = id;
	}

	public CtnCpaSpec(int id, CpaFun cpaFun, CtnUser ctnUser,
			CtnCpaVer ctnCpaVer, String specTyp, String fileName,
			Date createDate) {
		this.id = id;
		this.cpaFun = cpaFun;
		this.ctnUser = ctnUser;
		this.ctnCpaVer = ctnCpaVer;
		this.specTyp = specTyp;
		this.fileName = fileName;
		this.createDate = createDate;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cpa_fun_id")
	public CpaFun getCpaFun() {
		return this.cpaFun;
	}

	public void setCpaFun(CpaFun cpaFun) {
		this.cpaFun = cpaFun;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "create_user")
	public CtnUser getCtnUser() {
		return this.ctnUser;
	}

	public void setCtnUser(CtnUser ctnUser) {
		this.ctnUser = ctnUser;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CPA_VER_ID")
	public CtnCpaVer getCtnCpaVer() {
		return this.ctnCpaVer;
	}

	public void setCtnCpaVer(CtnCpaVer ctnCpaVer) {
		this.ctnCpaVer = ctnCpaVer;
	}

	@Column(name = "SPEC_TYP", length = 3)
	public String getSpecTyp() {
		return this.specTyp;
	}

	public void setSpecTyp(String specTyp) {
		this.specTyp = specTyp;
	}

	@Column(name = "file_name", length = 100)
	public String getFileName() {
		return this.fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_date", length = 19)
	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}


	@Override
	public int compareTo(Object o) {
		CtnCpaSpec other=(CtnCpaSpec)o;
		if(this.getCreateDate().after(other.getCreateDate()))
			return 1;
		else if(this.getCreateDate().after(other.getCreateDate()))
			return -1;
		else
			return 0;
	}

}
